#!/bin/bash
### Specify job parameters
#SBATCH -N 1 -n 44
#SBATCH -t 48:00:00
#SBATCH -J katrina8A # name of the job
#SBATCH -o katrina8km.out # File to which STDOUT will be written 
#SBATCH -e katrina8km.err # File to which STDERR will be written


### Tell SLURM which account to charge this job to
#SBATCH -A  momen
#SBATCH --mem=0



echo 'Started'

module load intel-oneapi/2022.2.0
export DIR=/project/momen/Lmatak/WRF_COAWST/LIBS
export CC=icc
export CXX=icpc
export CFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CXXFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export F77=ifort
export FC=ifort
export FFLAGS='-O3 -xHost -ip -no-prec-div -static-intel'
export CPP='icc -E'
export CXXCPP='icpc -E'
export JASPERLIB=$DIR/grib2/lib
export JASPERINC=$DIR/grib2/include
export LDFLAGS=-L$DIR/grib2/lib
export CPPFLAGS=-I$DIR/grib2/include
export LD_LIBRARY_PATH=$DIR/grib2/lib:$LD_LIBRARY_PATH
ulimit -s unlimited
export MALLOC_CHECK_=0
export LD_LIBRARY_PATH=$DIR/grib2/lib:$LD_LIBRARY_PATH
export PATH=$DIR/hdf5/bin:$PATH
export LD_LIBRARY_PATH=$DIR/hdf5/lib:$LD_LIBRARY_PATH
export HDF5_HOME=$DIR/hdf5
export HDF5_INCDIR=$HDF5_HOME/include
export HDF5_LIBDIR=$HDF5_HOME/lib
export PATH=$DIR/netcdf/bin:$PATH
export LD_LIBRARY_PATH=$DIR/netcdf/lib:$LD_LIBRARY_PATH
export NETCDF=$DIR/netcdf
export NETCDF_INC=$NETCDF/include
export NETCDF_LIB=$NETCDF/lib
export NETCDF_INCDIR=$NETCDF/include
export NETCDF_LIBDIR=$NETCDF/lib
export NETCDF_CONFIG=$NETCDF/bin
export NETCDFPATH=$NETCDF
export WRFIO_NCD_LARGE_FILE_SUPPORT=1
export MCT_INCDIR=$DIR/MCT/include
export MCT_LIBDIR=$DIR/MCT/lib
export I_MPI_F90=ifort
export NETCDF_DIR=$DIR/netcdf

ln -sf /project/momen/Lmatak/WRF_COAWST/WRF_COAWST_with_clz_10_to_20/coawstM .
ln -sf /project/momen/Lmatak/WRF_COAWST/WRF_COAWST_with_clz_10_to_20/*.TBL .
ln -sf /project/momen/Lmatak/WRF_COAWST/WRF_COAWST_with_clz_10_to_20/*.tbl .
ln -sf /project/momen/Lmatak/WRF_COAWST/WRF_COAWST_with_clz_10_to_20/*_DATA  .
mpirun ./coawstM coupling_katrina.in >"katrina.out"
